<?php

	require_once( 'constants/lib_paths.php' );

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
	<title>Futura OS Sign Up</title>
	<link rel="stylesheet" type="text/css" href="<?php echo  EXT_STYLE ?>" />
	<style type="text/css" media="screen">
		body {
			background-color: #ddd;
		}
	</style>
	<!-- GC -->
	<!-- LIBS -->
	<script type="text/javascript" src="<?php echo  EXT_ADAPTER ?>"></script>
	<!-- ENDLIBS -->
	<script type="text/javascript" src="<?php echo  EXT_BASE ?>"></script>
	<script type="text/javascript">
		Ext.onReady(function() {
			var form = new Ext.form.FormPanel({
				defaultType: 'textfield',
				bodyStyle: 'padding: 5px 5px 0',
				labelWidth: 105,
				frame: true,
				width: 335,
				defaults: { width: 200 },
				url: 'register.php',
				items: [
					{ name: 'fname', fieldLabel: 'Firstname', allowBlank: false },
					{ name: 'lname', fieldLabel: 'Lastname' },
					{ name: 'username', fieldLabel: 'Username', allowBlank: false },
					{ name: 'password', fieldLabel: 'Password', allowBlank: false, inputType: 'password', id: 'pass' },
					{ name: 'repass', fieldLabel: 'Re-type Password', allowBlank: false, inputType: 'password', validator: function(value) { if(value == Ext.get('pass').getValue()) return true; return false; } },
					{ name: 'dob', fieldLabel: 'Date of Birth', xtype: 'datefield' }
				]
			});
			
			form.addButton('Save', function() {
				if(form.getForm().isValid()) {
					form.getForm().submit({
						success: function(form, action) {
							Ext.Msg.alert("Success", action.result.msg);
							 window.location = 'index.php?signup=success';
						},
						failure: function(form, action) {
							Ext.Msg.alert("Failure", action.result.msg);
						}
					});
				}
			});
			
			form.addButton('Cancel', function() {
				window.location = "index.php";
			});
			
			var win = new Ext.Window({
				title: 'Sign up',
				resizable: false,
				closable: false,
				items: form
			});
			win.show();
		});
	</script>
</head>
<body>
	
</body>
</html>